package test;
import bean.Student;
import dao.StudentDAO;
import daoIMP.*;
import java.util.*;
//import java.util.ArrayList;

public class test{
//	public static void main(String arg[]) {
//		List<Student> s= new ArrayList();
//		Student s1=new Student();
//		 s1.setName("林寒菊");
//		 s1.setID(10005);
//		 StudentDAOIMP dao=new StudentDAOIMP();
//		 dao.insert(s1);
//		 s=dao.findAll();
//		 System.out.println("汪！汪！");
		
		 public void testinsert() {
				StudentDAO dao = new StudentDAOIMP();
				Student s = new Student();
				s.setID(10005);
				s.setName("程丰业");
				dao.insert(s);
			}
			public void testdelete() {
				StudentDAO dao = new StudentDAOIMP();
				dao.delete("10001");
			}
			public void testupdate() {
				StudentDAO dao = new StudentDAOIMP();
				Student s3 = new Student();
				s3.setID(10002);
				s3.setName("蓝芳草");
				dao.update(s3);
			}
			public void testfindbyid(int id) {
				StudentDAO dao = new StudentDAOIMP();
				Student s2=dao.findByID(id);
				System.out.println(s2.getID()+" "+s2.getName());
			}
			public void testfindall() {
				StudentDAO dao = new StudentDAOIMP();
				List<Student> stu = dao.findAll();
				for(Student student : stu) {
					System.out.println(student.getID()+" "+student.getName());
				}
			}
			public static void main(String[] args) {
				// TODO Auto-generated method stub
				test t = new test();
				t.testfindall();
				System.out.println("查找10002号");
				t.testfindbyid(10002);
				
				System.out.println("插入10005号，程丰业");
				t.testinsert();
				
				System.out.println("修改10002号兰芳草为，蓝芳草");
				t.testupdate();
				
				System.out.println("显示所有");
				t.testfindall();
			}
//	}
} 